// $Id$
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Xml.Serialization;
using Salamanca.DataAccess;
using Salamanca.DataAccess.Collections;
using Salamanca.DataRules;
#if (!NET_CF)
using System.Diagnostics.CodeAnalysis;
#endif

namespace Northwind.DomainModel
{

    /// <summary />
    partial interface IShipperContainer
    {
        /// <summary />
      Shipper Shipper
        {
            get;
            set;
        }

    }

    /// <summary />
    partial interface IShipperMapper
    {

        /// <summary />
        Shipper Find(Shipper.PrimaryKey key, DataMapperCollection dataMappers);
        /// <summary />
        DomainModelKeyedCollection<Shipper> FindAll(DataMapperCollection dataMappers);

    }

    /// <summary />
    partial class Shipper
    {

        /// <summary />
        partial class PrimaryKey
        {
            /// <summary />
            public static implicit operator PrimaryKey(int key)
            {
                return new PrimaryKey(key);
            }

            /// <summary />
            public static explicit operator int(PrimaryKey key)
            {
                return key.Value;
            }

        }

        /// <summary />
        partial class DataTransfer
        {
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public int ShipperID;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string CompanyName;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Phone;

            /// <summary />
            public object Clone()
            {
                return MemberwiseClone();
            }

        }

        /// <summary />
        protected override Shipper.PrimaryKey CreateId()
        {
            return new Shipper.PrimaryKey(Data.ShipperID);
        }

        /// <summary />
        internal Shipper.PrimaryKey GetId()
        {
            return Id;
        }

        /// <summary />
        internal void SetId(int id)
        {
            Data.ShipperID=id;
        }


        /// <summary />
#if (!NET_CF)
        [DataObjectMethod(DataObjectMethodType.Select, false)]
#endif
        public static Shipper Find(Shipper.PrimaryKey key, DataMapperCollection dataMappers)
        {
            return ((IShipperMapper)dataMappers[typeof(Shipper)]).Find(key, dataMappers);
        }

        /// <summary />
#if (!NET_CF)
        [DataObjectMethod(DataObjectMethodType.Select, true)]
#endif
        public static IList<Shipper> FindAll(DataMapperCollection dataMappers)
        {
            return ((IShipperMapper)dataMappers[typeof(Shipper)]).FindAll(dataMappers);
        }

        /// <summary />
        internal bool InternalIsNew
        {
            get
            {
                return IsNew;
            }
        }

        /// <summary />
        private string _CompanyNameProperty
        {
            get
            {
                Load(true);
                return Data.CompanyName;
            }
            set
            {
                if (Data.CompanyName!=value)
                {
                    Data.CompanyName=value;
                }
            }
        }

        /// <summary />
        private string _PhoneProperty
        {
            get
            {
                Load(true);
                return Data.Phone;
            }
            set
            {
                if (Data.Phone!=value)
                {
                    Data.Phone=value;
                }
            }
        }


        /// <summary />
        public static readonly IdentityMap<Shipper.PrimaryKey, Shipper> IdentityMap=new IdentityMap<Shipper.PrimaryKey, Shipper>();

    }

}
